import React, {Component} from 'react';
import {
  View,
  Text,
  Alert,
  Button,
  ToastAndroid,
  TextInput,
  StyleSheet,
  Dimensions,
  TouchableOpacity,
  ScrollView,
  Image,
} from 'react-native';

let widthScreen = Dimensions.get('window').width;
let heightScreen = Dimensions.get('window').height;
let typeColor1 = '#9966FF';
let typeColor2 = '#9966FF';

export default class ProposalEntry extends Component {
  static defaultProps = {
    title: '提案列表',
    type: 3,
  };

  constructor(props) {
    super(props);
  }

  //TODO:render 这个类的适应效果可能有些差劲，应该要调试下
  render() {
    return (
      <TouchableOpacity>
        <View
          style={{height: heightScreen * 0.106, backgroundColor: '#FFFFFF'}}>
          <View style={{flexDirection: 'row'}}>
            <View
              style={{
                marginTop: heightScreen * 0.008,
                marginLeft: heightScreen * 0.03,
                width: heightScreen * 0.01,
                height: heightScreen * 0.033,
                backgroundColor: this.props.color,
              }}
            />
            <View>
              <Text style={proposalEntryStyle.title}>{this.props.title}</Text>
              <View
                style={{
                  marginLeft: heightScreen * 0.007,
                  height: 0.5,
                  width: heightScreen * 0.311,
                  backgroundColor: this.props.color,
                }}
              />
              <Text style={proposalEntryStyle.text1}>
                提案人：{this.props.person}
              </Text>
              <Text style={proposalEntryStyle.text2}>{this.props.info}</Text>
            </View>
            <Text
              style={{
                textAlign: 'right',
                color: this.props.color,
                fontSize: heightScreen * 0.019,
                //fontFamily: 'MicrosoftYaHei',
                marginTop: heightScreen * 0.014,
                width: widthScreen * 0.27,
              }}>
              {this.props.stageResult}
            </Text>
          </View>
        </View>
      </TouchableOpacity>
    );
  }
}

let proposalEntryStyle = StyleSheet.create({
  rect: {
    marginTop: heightScreen * 0.008,
    marginLeft: heightScreen * 0.03,
    width: heightScreen * 0.01,
    height: heightScreen * 0.033,
    backgroundColor: typeColor1,
  },
  line: {
    marginLeft: heightScreen * 0.007,
    height: 0.5,
    width: heightScreen * 0.311,
    backgroundColor: typeColor1,
  },
  title: {
    marginTop: heightScreen * 0.006,
    marginBottom: heightScreen * 0.002,
    marginLeft: heightScreen * 0.006,
    fontSize: heightScreen * 0.024,
    color: '#000000',
    //fontFamily: 'MicrosoftYaHei',
    fontWeight: '400',
  },
  colorTitle: {
    textAlign: 'right',
    color: typeColor2,
    fontSize: heightScreen * 0.019,
    //fontFamily: 'MicrosoftYaHei',
    marginTop: heightScreen * 0.014,
    width: widthScreen * 0.27,
  },
  text1: {
    marginLeft: heightScreen * 0.006,
    fontSize: heightScreen * 0.018,
    //fontFamily: 'MicrosoftYaHei',
    color: '#666666',
    marginTop: heightScreen * 0.005,
  },
  text2: {
    marginLeft: heightScreen * 0.006,
    fontSize: heightScreen * 0.018,
    //fontFamily: 'MicrosoftYaHei',
    color: '#666666',
  },
});
